game.import("extension",function(lib,game,ui,get,ai,_status){return {name:"纷争扩展",content:function(config,pack){
    
},precontent:function(){
    
},help:{},config:{},package:{
    character:{
        character:{
            "fz_gaoshun":["male","qun",5,["fz_xianjing","hanzhan"],[]],
            "fz_madai":["male","shu",4,["mashu","fz_qianxi","fz_bizhong","ol_shichou","fz_shuangdao"],[]],
            "fz_jiaxu":["male","qun",3,["rewansha","fz_luanwu","reweimu","yongdi"],[]],
            "fz_shenxunyu":["male","shen",3,["tianzuo","lingce","dinghan","fz_qizheng"],[]],
            "fz_shenguojia":["male","shen",3,["reshuishi","stianyi","resghuishi","fz_jinnang"],[]],
            "fz_shenganning":["male","shen","3/6",["drlt_poxi","drlt_jieying","fz_yingzi","fz_shuangsha","fz_shuangdao","mashu"],[]],
            "fz_pangtong":["male","shu",3,["ollianhuan","olniepan","fz_tianlei"],[]],
            "fz_zhangjiao":["male","qun",3,["fz_chedian","xinguidao","xinhuangtian","fz_xinfencheng"],["zhu"]],
            "fz_manchong":["male","wei",3,["rejunxing","yuce","fz_bingle","shibei"],[]],
            "fz_wenyang":["male","wei",9,["fz_quedi","dbzhuifeng","fz_choujue"],[]],
            "fz_zhoutai":["male","wu",4,["buqu","fenji","jieming"],[]],
            "fz_huanggai":["male","wu",4,["rekurou","zhaxiang","xindangxian","xinfuli","oltishen"],[]],
            "fz_zhugeke":["male","wu",3,["aocai","duwu","fz_liji"],[]],
            "fz_zhangliao":["male","wei",4,["reyingzi","fz_tuji","rejuece"],[]],
            "fz_machao":["male","shu",4,["retieji","zhuiji","ol_shichou","wushuang","fz_shuangdao"],[]],
            "fz_huaxiong":["male","qun",6,["reyaowu","new_reyiji","fz_juedou"],[]],
            "fz_xusheng":["male","wu",4,["repojun","fz_guding"],[]],
            "fz_guanyu":["male","shu",4,["new_rewusheng","fz_yijue","fz_weizhen"],[]],
            "fz_taishici":["male","wu",4,["tianyi","hanzhan","repojun"],[]],
            "fz_zhaoyun":["male","shu",4,["ollongdan","chongzhen","olyajiao","fz_qiangshu"],[]],
            "fz_wuyi":["male","shu",4,["benxi","fz_jimou","ol_shichou","zaiqixx","xinkuanggu"],[]],
            "fz_wuqidashi":["male","shen",3,["xinjushou","shebian","decadexuanfeng","fz_duodao","jiushi","yongjin"],[]],
            "fz_sunce":["male","wu",4,["jiang","olzhiba","fz_bawang","fz_hunzi","gzyinghun","fz_yingzi","fz_yuyong"],["zhu"]],
            "fz_zhangfei":["male","shu",4,["olpaoxiao","oltishen","fz_nuhou"],[]],
            "fz_sunquan":["male","wu",9,["benghuai","jiuyuan","fz_yongsi","fz_zhiheng2"],["zhu"]],
            "fz_huangzhong":["male","shu",4,["fz_liegong","fz_lianpo"],[]],
            "fz_chendao":["male","shu",4,["fz_wanglie","fz_fangzhu"],[]],
            "fz_lvbu":["male","qun",5,["wushuang","fz_haodou","fz_renfu"],[]],
            "fz_caocao":["male","wei",4,["rehujia","new_reyiji","mingjian","new_rejianxiong","fz_zhiheng3"],["zhu"]],
            "fz_zhangchunhua":["female","wei",3,["shangshi","fz_zhishi","fz_huaibeng","xingshuai"],["zhu"]],
            "fz_zhangxingcai":["female","shu",4,["shenxian","qiangwu","fz_fengpo"],[]],
            "fz_tongyuan":["male","qun",4,["fz_chaofeng","ollongdan"],[]],
            "fz_quyi":["male","qun",5,["fz_fuji","fz_jiaozi"],[]],
            "fz_shixuekuangmo":["male","shen",4,["fz_xuenu"],[]],
            "fz_dianwei":["male","wei",4,["fz_qiangxi","fz_shuangji","fz_hanyong"],[]],
            "fz_ganning":["male","wu",4,["fz_qixi","fz_hanzhan"],[]],
            "fz_xiahouyuan":["male","wei",4,["fz_shensu"],[]],
        },
        translate:{
            "fz_gaoshun":"高顺",
            "fz_madai":"马岱",
            "fz_jiaxu":"贾诩",
            "fz_shenxunyu":"神荀彧",
            "fz_shenguojia":"神郭嘉",
            "fz_shenganning":"神甘宁",
            "fz_pangtong":"庞统",
            "fz_zhangjiao":"张角",
            "fz_manchong":"满宠",
            "fz_wenyang":"文鸯",
            "fz_zhoutai":"周泰",
            "fz_huanggai":"黄盖",
            "fz_zhugeke":"诸葛恪",
            "fz_zhangliao":"张辽",
            "fz_machao":"马超",
            "fz_huaxiong":"华雄",
            "fz_xusheng":"徐盛",
            "fz_guanyu":"关羽",
            "fz_taishici":"太史慈",
            "fz_zhaoyun":"赵云",
            "fz_wuyi":"吴懿",
            "fz_wuqidashi":"武器大师",
            "fz_sunce":"孙策",
            "fz_zhangfei":"张飞",
            "fz_sunquan":"孙权",
            "fz_huangzhong":"黄忠",
            "fz_chendao":"陈到",
            "fz_lvbu":"吕布",
            "fz_caocao":"曹操",
            "fz_zhangchunhua":"张春华",
            "fz_zhangxingcai":"张星彩",
            "fz_tongyuan":"童渊",
            "fz_quyi":"麴义",
            "fz_shixuekuangmo":"嗜血狂魔",
            "fz_dianwei":"典韦",
            "fz_ganning":"甘宁",
            "fz_xiahouyuan":"夏侯渊",
        },
    },
    card:{
        card:{
        },
        translate:{
        },
        list:[],
    },
    skill:{
        skill:{
            "fz_bingle":{
                group:["fz_bingle_1","fz_bingle_2"],
                subSkill:{
                    "1":{
                        audio:"ext:无名扩展:2",
                        filter:function(event,player){
                return player.countCards('hes',{color:'red'})>0;
            },
                        enable:"chooseToUse",
                        filterCard:function(card){
                return get.color(card)=='red';
            },
                        position:"hes",
                        viewAs:{
                            name:"lebu",
                        },
                        prompt:"将一张红色牌当乐不思蜀使用",
                        check:function(card){return 9-get.value(card)},
                        ai:{
                            threaten:1.5,
                            basic:{
                                order:1,
                                useful:1,
                                value:8,
                            },
                            result:{
                                ignoreStatus:true,
                                target:function(player,target){
                        var num=target.hp-target.countCards('h')-2;
                        if(num>-1) return -0.01;
                        if(target.hp<3) num--;
                        if(target.isTurnedOver()) num/=2;
                        var dist=get.distance(player,target,'absolute');
                        if(dist<1) dist=1;
                        return num/Math.sqrt(dist)*get.threaten(target,player);
                    },
                            },
                            tag:{
                                skip:"phaseUse",
                            },
                        },
                        sub:true,
                    },
                    "2":{
                        audio:"ext:无名扩展:2",
                        enable:"chooseToUse",
                        filterCard:function(card){
                 return (get.color(card)=='black');
            },
                        filter:function(event,player){
                return player.hasCard((card)=>(get.color(card)=='black'),'hes');
            },
                        position:"hes",
                        viewAs:{
                            name:"bingliang",
                        },
                        prompt:"将一张黑色牌当做兵粮寸断使用",
                        check:function(card){return 6-get.value(card)},
                        ai:{
                            order:9,
                            basic:{
                                order:1,
                                useful:1,
                                value:4,
                            },
                            result:{
                                target:function(player,target){
                        if(target.hasJudge('caomu')) return 0;
                        return -1.5/Math.sqrt(target.countCards('h')+1);
                    },
                            },
                            tag:{
                                skip:"phaseDraw",
                            },
                        },
                        mod:{
                            targetInRange:function(card,player,target){
                    if(card.name=='bingliang') return true;
                },
                        },
                        sub:true,
                    },
                },
            },
            "fz_yijue":{
                shaRelated:true,
                audio:"yijue",
                trigger:{
                    player:"useCardToPlayered",
                },
                filter:function(event,player){
        return event.card.name=='sha';
    },
                check:function(trigger,player){
        return get.attitude(player,trigger.target)<0;
    },
                content:function (){
        if(!trigger.target.hasSkill('fengyin')){
            trigger.target.addTempSkill('fengyin');
        }
        trigger.target.addTempSkill('new_yijue2');
        var nd=0;
        if(trigger.target.hp>=player.hp){
            nd++;
        }
        if(get.suit(trigger.card)=='heart'){
            nd++;
        }
        var trigger2=trigger.getParent();
        if(typeof trigger2.baseDamage!='number'){
            trigger2.baseDamage=1;
        }
        trigger2.baseDamage+=nd;
    },
                ai:{
                    "directHit_ai":true,
                },
            },
            "fz_qianxi":{
                audio:"oldqianxi",
                trigger:{
                    source:"damageBegin2",
                },
                check:function(event,player){
        var att=get.attitude(player,event.player);
        var gap=event.player.maxHp-event.player.hp;
        if(att>0) return false;
        if(gap>=5) return false;
        if(event.player.hp<=2&&gap>=4) return false;
        return true;
    },
                filter:function(event,player){
        return event.card&&event.card.name=='sha'&&event.player.maxHp>1;
    },
                content:function(){
        var num=trigger.num;
        if(num>=trigger.player.maxHp){
            num=trigger.player.maxHp-1;
        }
        trigger.cancel();
        trigger.player.loseMaxHp(num);
    },
                ai:{
                    threaten:1.9,
                },
            },
            "fz_xianjing":{
                audio:"xianzhen",
                enable:"phaseUse",
                usable:2,
                filterTarget:function(card,player,target){
        return player.canCompare(target);
    },
                filter:function(event,player){
        return player.countCards('h')>0;
    },
                content:function(){
        "step 0"
        player.chooseToCompare(target);
        "step 1"
        if(result.bool){
            var num=result.num1-result.num2;
            target.damage(Math.ceil(num/2));
        }else{
            if(target.countCards('e')>0){
                player.gainPlayerCard('获得一张装备牌',target,'e','visibleMove');
            }   
        }
    },
                ai:{
                    order:9,
                    result:{
                        player:function(player){
                   return 1;
            },
                        target:function(player,target){
                return -1;
            },
                    },
                    threaten:1.3,
                },
            },
            "fz_bizhong":{
                audio:"liegong",
                audioname:["re_huangzhong"],
                trigger:{
                    player:"useCardToTargeted",
                },
                check:function(event,player){
        return get.attitude(player,event.target)<=0;
    },
                filter:function(event,player){
        return event.card.name=='sha'&&event.target.maxHp>1;
    },
                content:function(){
        trigger.getParent().directHit.push(trigger.target);
    },
                ai:{
                    threaten:0.5,
                    "directHit_ai":true,
                },
            },
            "fz_bawang":{
                audio:"ext:纷争扩展:2",
                filter:function(event,player){
        return player.countCards('hes',{suit:'club'})>0;
    },
                enable:"chooseToUse",
                filterCard:function(card){
        return get.suit(card)=='club';
    },
                position:"hes",
                viewAs:{
                    name:"juedou",
                },
                prompt:"将一张梅花牌当决斗使用",
                check:function(card){return 6-get.value(card)},
                ai:{
                    threaten:1.5,
                    basic:{
                        order:9,
                        useful:1,
                        value:8,
                    },
                    result:{
                        ignoreStatus:true,
                        target:function(player,target){
                return target.countCards('h')-player.countCards('h')-3;
            },
                        player:function(player,target,card){
                if(player.hasSkillTag('directHit_ai',true,{
                    target:target,
                    card:card,
                },true)){
                    return 0;
                }
                if(get.damageEffect(target,player,target)>0&&get.attitude(player,target)>0&&get.attitude(target,player)>0){
                    return 0;
                }
                var hs1=target.getCards('h','sha');
                var hs2=player.getCards('h','sha');
                if(hs1.length>hs2.length+1){
                    return -2;
                }
                var hsx=target.getCards('h');
                if(hsx.length>2&&hs2.length==0&&hsx[0].number<6){
                    return -2;
                }
                if(hsx.length>3&&hs2.length==0){
                    return -2;
                }
                if(hs1.length>hs2.length&&(!hs2.length||hs1[0].number>hs2[0].number)){
                    return -2;
                }
                return -0.5;
            },
                    },
                    tag:{
                        skip:"phaseUse",
                        respond:2,
                        respondSha:2,
                        damage:1,
                    },
                    wuxie:function(target,card,player,viewer){
            if(player==game.me&&get.attitude(viewer,player)>0){
                return 0;
            }
        },
                },
            },
            "fz_qiangshu":{
                shaRelated:true,
                audio:"ext:无名扩展:2",
                trigger:{
                    player:"useCardToPlayered",
                },
                filter:function(event,player){
        return event.card.name=='sha';
    },
                check:function(trigger,player){
        return get.attitude(player,trigger.target)<0;
    },
                content:function(){
        var nd=0;
        if(trigger.target.countCards('h',{suit:'diamond'})){
            nd++;
        }
        if(trigger.target.countCards('h',{suit:'heart'})){
            nd++;
        }
        if(trigger.target.countCards('h',{suit:'club'})){
            nd++;
        }
        if(trigger.target.countCards('h',{suit:'spade'})){
            nd++;
        }
        var trigger2=trigger.getParent();
        if(typeof trigger2.baseDamage!='number'){
            trigger2.baseDamage=1;
        }
        trigger2.baseDamage+=nd;
    },
            },
            "fz_yingzi":{
                audio:"ext:纷争扩展:2",
                audioname:["heqi","sunce","gexuan","re_sunben","re_sunce","re_heqi"],
                trigger:{
                    player:"phaseDrawBegin2",
                },
                forced:true,
                preHidden:true,
                filter:function(event,player){
        return !event.numFixed;
    },
                content:function(){
        player.logSkill("reyingzi");
        if(player.hp>=2){
            trigger.num++;
        }
        if(player.countCards('h')>=2){
            trigger.num++;
        }
        if(player.countCards('e')>=1){
            trigger.num++;
        }        
    },
                ai:{
                    threaten:1.5,
                },
                mod:{
                    maxHandcardBase:function(player,num){
            if(player.hp>=2){
                num++;
            }
            if(player.countCards('h')>=2){
                num++;
            }
            if(player.countCards('e')>=1){
                num++;
            }  
            return num;
        },
                },
            },
            "fz_miansha":{
                zhuSkill:true,
                audio:"ext:纷争扩展:2",
                trigger:{
                    player:"damageBegin4",
                },
                filter:function(event,player){
        return game.filterPlayer().length>5&&player.hasZhuSkill("面纱")&&event.num>2;
    },
                frequent:true,
                content:function(){
        "step 0"
        event.card=get.cards()[0];
        game.cardsGotoOrdering(event.card);
        event.videoId=lib.status.videoId++;
        var judgestr=get.translation(player)+'发动了【面纱】';
        game.addVideo('judge1',player,[get.cardInfo(event.card),judgestr,event.videoId]);
        game.broadcastAll(function(player,card,str,id,cardid){
            var event;
            if(game.online){
                event={};
            }
            else{
                event=_status.event;
            }
            if(game.chess){
                event.node=card.copy('thrown','center',ui.arena).animate('start');
            }
            else{
                event.node=player.$throwordered(card.copy(),true);
            }
            if(lib.cardOL) lib.cardOL[cardid]=event.node;
            event.node.cardid=cardid;
            event.node.classList.add('thrownhighlight');
            ui.arena.classList.add('thrownhighlight');
            event.dialog=ui.create.dialog(str);
            event.dialog.classList.add('center');
            event.dialog.videoId=id;
        },player,event.card,judgestr,event.videoId,get.id());

        game.log(player,'亮出了',event.card);
        game.delay(2);
        if(get.color(event.card)=='red'){
            trigger.num--;
        }
        event.disbool=true;
        "step 1"
        if(event.disbool){
            event.dialog.close();
            game.addVideo('judge2',null,event.videoId);
            game.addVideo('deletenode',player,[get.cardInfo(event.node)]);
            event.node.delete();
            game.broadcast(function(id,card){
                var dialog=get.idDialog(id);
                if(dialog){
                    dialog.close();
                }
                if(card.clone){
                    card.clone.delete();
                }
                ui.arena.classList.remove('thrownhighlight');
            },event.videoId,event.card);
            ui.arena.classList.remove('thrownhighlight');
        }
    },
            },
            "fz_yongdi":{
                audio:"ext:纷争扩展:2",
                audioname:["xinping"],
                unique:true,
                limited:true,
                trigger:{
                    player:"phaseZhunbeiBegin",
                },
                animationColor:"thunder",
                skillAnimation:"legend",
                filter:function(event,player){
        return !player.storage.yongdi;
    },
                init:function(player){
        player.storage.yongdi=false;
    },
                mark:true,
                intro:{
                    content:"limited",
                },
                direct:true,
                content:function(){
        'step 0'
        player.chooseTarget(get.prompt2('yongdi'),function(card,player,target){
            return (target.hasSex('male')||target.hasSex('female')||target.name=='key_yuri')&&target!=player;
        }).set('ai',function(target){
            if(!_status.event.goon) return 0;
            var player=_status.event.player;
            var att=get.attitude(player,target);
            if(att<=1) return 0;
            var mode=get.mode();
            if(mode=='identity'||(mode=='versus'&&_status.mode=='four')){
                if(target.name&&lib.character[target.name]){
                    for(var i=0;i<lib.character[target.name][3].length;i++){
                        if(lib.skill[lib.character[target.name][3][i]].zhuSkill){
                            return att*2;
                        }
                    }
                }
            }
            return att;
        }).set('goon',!player.hasUnknown());
        'step 1'
        if(result.bool){
            player.awakenSkill('yongdi');
            player.storage.yongdi=true;
            player.logSkill('yongdi',result.targets);
            var target=result.targets[0];
            target.gainMaxHp(true);
            target.recover();
            var mode=get.mode();
            if(mode=='identity'||(mode=='versus'&&_status.mode=='four')){
                if(target.name&&lib.character[target.name]){
                    var skills=lib.character[target.name][3];
                    target.storage.zhuSkill_yongdi=[];
                    for(var i=0;i<skills.length;i++){
                        var info=lib.skill[skills[i]];
                        if(info.zhuSkill){
                            target.storage.zhuSkill_yongdi.push(skills[i]);
                            if(info.init){
                                info.init(target);
                            }
                            if(info.init2){
                                info.init2(target);
                            }
                        }
                    }
                }
            }
        }
    },
                ai:{
                    expose:0.2,
                },
            },
            "fz_luanwu":{
                audio:"ext:纷争扩展:2",
                audioname:["re_jiaxu"],
                unique:true,
                enable:"phaseUse",
                usable:2,
                skillAnimation:"epic",
                animationColor:"thunder",
                filterTarget:function(card,player,target){
        return target!=player;
    },
                selectTarget:-1,
                multitarget:true,
                multiline:true,
                content:function(){
        "step 0"
        event.current=player.next;
        event.currented=[];
        "step 1"
        event.currented.push(event.current);
        event.current.animate('target');
        event.current.chooseToUse('乱武：使用一张杀或失去一点体力',function(card){
            if(get.name(card)!='sha') return false;
            return lib.filter.filterCard.apply(this,arguments)
        },function(card,player,target){
            if(player==target) return false;
            var dist=get.distance(player,target);
            if(dist>1){
                if(game.hasPlayer(function(current){
                    return current!=player&&get.distance(player,current)<dist;
                })){
                    return false;
                }
            }
            return lib.filter.filterTarget.apply(this,arguments)
        }).set('ai2',function(){
            return get.effect_use.apply(this,arguments)+0.01;
        });
        "step 2"
        if(result.bool==false) event.current.loseHp();
        event.current=event.current.next;
        if(event.current!=player&&!event.currented.contains(event.current)){
            game.delay(0.5);
            event.goto(1);
        }
    },
                ai:{
                    order:5,
                    result:{
                        player:function(player){
                var otherplayers=game.filterPlayer(function(current){
                    return current!=player;
                });
                var enemyplayers=game.filterPlayer(function(current){
                    return current!=player&&get.attitude(player,current)<0;
                });
                if(otherplayers.length==enemyplayers.length){
                    if(lib.config.mode=='identity'&&game.zhu.isZhu){
                        if(player.identity=='fan'){
                            return 1;
                        }else{
                            if(game.zhu.hp<=2) return -1;
                        }
                    }
                }
                if(otherplayers.length==1){
                    return 1;
                }
                if(lib.config.mode=='identity'&&game.zhu.isZhu&&player.identity!='fan'){
                    if(game.zhu.countCards('h')<=2) return -1;
                    if(game.zhu.hp<=1) return -1;
                    if(game.zhu.hp<=2&&game.zhu.countCards('h')<=3) return -1;
                }
                if(lib.config.mode=='identity'&&game.zhu.isZhu&&player.identity=='fan'){
                    if(game.zhu.countCards('h')<=2) return 1;
                    if(game.zhu.hp<=3&&game.zhu.countCards('h')<=3) return 1;
                    if(game.zhu.hp<=2&&game.zhu.countCards('h')<=4) return 1;
                    if(game.zhu.hp<=1) return 1;
                }
                var friend=0;
                var enemy=0;
                var damagedPlayer=0;
                var hpLess2Enemy=0;
                var hpLess2Friend=0
                var hpLess1Enemy=0;
                var heLess3Player=0;
                for(var i=0;i<otherplayers.length;i++){
                    var playeri=otherplayers[i]
                    var att=get.attitude(player,playeri);
                    if(att>0) {
                        friend++;
                        if(playeri.hp==1){
                            return -1;
                        }
                        if(playeri.hp<=2){
                            hpLess2Friend++;
                        }
                    }
                    if(att<0) {
                        enemy++;
                        if(playeri.hp<=1&playeri.countCards('h')<=3){
                            return 1;
                        }
                        if(playeri.hp<=2&&playeri.countCards('h')<=2){
                            return 1;
                        }
                        if(playeri.countCards('h')<=1){
                            return 1;
                        }
                        if(playeri.hp<=2){
                            hpLess2Enemy++;
                        }
                        if(playeri.hp<=1){
                            hpLess1Enemy++;
                        }
                    }
                    if(playeri.hp<=3){
                        heLess3Player++;
                    }
                    if(playeri.isDamaged()) {
                        damagedPlayer++;
                    }
                }
                if(damagedPlayer<=1){
                    return 1;
                }
                if(friend<=1){
                    return 1;
                }
                if(hpLess1Enemy>=2){
                    return 1;
                }
                if(hpLess2Friend<=hpLess2Enemy){
                    return 1;
                }else{
                    return -1;
                }
                if(hpLess2Enemy>1){
                    return 1;
                }
                if(heLess3Player<=1){
                    return 1;
                }
                //former logic
                if(lib.config.mode=='identity'&&game.zhu.isZhu&&player.identity=='fan'){
                    if(game.zhu.hp==1&&game.zhu.countCards('h')<=2) return 1;
                }
                var num=0;
                var players=game.filterPlayer();
                for(var i=0;i<players.length;i++){
                    var att=get.attitude(player,players[i]);
                    if(att>0) att=1;
                    if(att<0) att=-1;
                    if(players[i]!=player&&players[i].hp<=3){
                        if(players[i].countCards('h')==0) num+=att/players[i].hp;
                        else if(players[i].countCards('h')==1) num+=att/2/players[i].hp;
                        else if(players[i].countCards('h')==2) num+=att/4/players[i].hp;
                    }
                    if(players[i].hp==1) num+=att*1.5;
                }
                if(player.hp==1){
                    return -num;
                }
                if(player.hp==2){
                    return -game.players.length/4-num;
                }
                return -game.players.length/3-num;
            },
                    },
                },
            },
            "fz_qizheng":{
                audio:"ext:纷争扩展:2",
                enable:"phaseUse",
                usable:1,
                filter:function(event,player,target){
        return target!=player;
    },
                content:function (){
        "step 0"
         player.chooseTarget('请选择至多三名角色视为使用奇正相生',[1,3],function(card,player,target){
           return player!=target;
         }).ai=function(target){
           return 1-get.attitude(player,target);
         };
        "step 1"
        if(result.bool){
          player.useCard({name:'qizhengxiangsheng'},result.targets,false);
        }
    },
                ai:{
                    order:9,
                    threaten:1.6,
                    expose:0.2,
                    result:{
                        player:1,
                    },
                },
            },
            "fz_jinnang":{
                audio:"ext:纷争扩展:2",
                enable:"phaseUse",
                usable:1,
                filter:function(event,player){
        for(var i of lib.inpile){
            if(get.type(i)=='trick'&&event.filterCard({name:i,isCard:true},player,event)) return true;
        }
        return false;
    },
                chooseButton:{
                    dialog:function(event,player){
            var list=[];
            for(var i of lib.inpile){
                if(get.type(i)=='trick'&&event.filterCard({name:i,isCard:true},player,event)) list.push(['锦囊','',i]);
            }
            return ui.create.dialog('佐幸',[list,'vcard']);
        },
                    check:function(button){
            return _status.event.player.getUseValue({name:button.link[2],isCard:true});
        },
                    backup:function(links,player){
            return {
                viewAs:{
                    name:links[0][2],
                    isCard:true,
                },
                filterCard:()=>false,
                selectCard:-1,
                popname:true,
                precontent:function(){
                    player.logSkill('fz_jinnang');
                    //delete event.result.skill;
                },
            }
        },
                    prompt:function(links,player){
            return '请选择'+get.translation(links[0][2])+'的目标';
        },
                },
                ai:{
                    order:9,
                    result:{
                        player:1,
                    },
                },
            },
            "fz_tianlei":{
                check:function(trigger,player){
        return get.attitude(player,trigger.player)<0;
    },
                trigger:{
                    global:["phaseJudgeBegin"],
                },
                filter:function(trigger,player){
        var num=trigger.player.countCards("j",function(card){ 
            return card.name=="shandian"; 
        });
        return num==0&&trigger.player.isAlive();
    },
                content:function(){
        //var card=get.cardPile2(function(card){
        //    return true;
        //});
        //player.line(trigger.player,'thunder');
        //trigger.player.useCard({'name':'shandian'},[card],trigger.player,false);
        "step 0"
        player.logSkill('xinleiji',trigger.player,'thunder');
        trigger.player.judge();
        "step 1"
        if(result.suit){
            if(result.suit=='spade'&&result.number>=2&&result.number<=9){
                trigger.player.damage('thunder',3);
            }
        }
    },
                ai:{
                    threaten:1.6,
                    expose:0.2,
                },
            },
            "fz_huaibeng":{
                audio:"ext:纷争扩展:2",
                audioname:["zhugedan","re_dongzhuo","ol_dongzhuo"],
                trigger:{
                    player:"phaseJieshuBegin",
                },
                forced:true,
                check:function(){
        return false;
    },
                filter:function(event,player){
        var bool=true;
        var otherplayers=game.filterPlayer(function(current){
            return current!=player;
        });
        for(var i=0;i<otherplayers.length;i++){
            if(otherplayers[i].hp>=player.hp){
                bool=false;
            }
        }
        return bool&&!player.hasSkill('rejiuchi_air')&&!player.hasSkill('oljiuchi_air');
    },
                content:function(){
     
            player.loseHp();
   
    },
                ai:{
                    threaten:0.5,
                    neg:true,
                },
            },
            "fz_liji":{
                enable:"phaseUse",
                audio:"ext:纷争扩展:2",
                filter:function(event,player){
        return (player.getStat().skill.liji||0)<(event.liji_num||0);
    },
                onChooseToUse:function(event){
        if(game.online) return;
        var num=0;
        var evt2=event.getParent();
        if(!evt2.liji_all) evt2.liji_all=3;
        game.getGlobalHistory('cardMove',function(evt){
            if(evt.name=='cardsDiscard'||(evt.name=='lose'&&evt.position==ui.discardPile)) num+=evt.cards.length;
        });
        event.set('liji_num',Math.floor(num/evt2.liji_all));
    },
                filterCard:true,
                position:"he",
                check:function(card){
        var val=get.value(card);
        if(!_status.event.player.getStorage('refenyin_mark').contains(get.suit(card))) return 12-val;
        return 8-val;
    },
                filterTarget:function(card,player,target){
        return player!=target;
    },
                content:function(){
        target.damage('nocard');
    },
                ai:{
                    order:1,
                    result:{
                        target:-1.5,
                    },
                    tag:{
                        damage:1,
                    },
                },
            },
            "fz_nuhou":{
                shaRelated:true,
                group:["fz_nuhou_1","fz_nuhou_2"],
                subSkill:{
                    "1":{
                        enable:"phaseUse",
                        usable:1,
                        content:function(){
                "step 0"
                 player.chooseTarget('请选择一名角色视为使用杀',function(card,player,target){
                   return player!=target;
                 }).ai=function(target){
                   return 1-get.attitude(player,target);
                 };
                "step 1"
                if(result.bool){
                  player.useCard({name:'sha'},result.targets,false);
                }
            },
                        ai:{
                            order:10,
                            result:{
                                player:1,
                            },
                            threaten:1.5,
                        },
                        sub:true,
                    },
                    "2":{
                        trigger:{
                            player:"shaAfter",
                        },
                        filter:function(event,player){
                return event.target!=player&&event.target.isAlive();
            },
                        check:function(trigger,player){
                return get.attitude(player,trigger.target)<0;
            },
                        content:function(){
                'step 0'
                player.judge();
                'step 1'
                if(result.color=='red') {
                    player.useCard({name:'sha'},trigger.target,false);
                }
            },
                        sub:true,
                    },
                },
            },
            "fz_duodao":{
                audio:"ext:纷争扩展:2",
                enable:"phaseUse",
                usable:1,
                check:function(trigger,player){
        return get.attitude(player,trigger.target)<=0;
    },
                content:function(){
        "step 0"
        player.chooseTarget('请选择一名其他角色获得其装备区内的一张武器牌',function(card,player,target){
            return player!=target&&target.getEquip(1);
        }).ai=function(target){
            return 1-get.attitude(player,target);
        };
        "step 1"
        if(result.bool){    
            player.logSkill("reduodao",result.targets[0]);
            player.line(result.targets[0],'green');
            player.gain(result.targets[0].getEquip(1),result.targets[0],'give');
        }
    },
                ai:{
                    order:9,
                    result:{
                        player:1,
                    },
                },
            },
            "fz_fengpo":{
                shaRelated:true,
                audio:"ext:无名扩展:2",
                trigger:{
                    player:"useCardToPlayered",
                },
                filter:function(event,player){
        if(event.targets.length!=1||!['sha','juedou'].contains(event.card.name)) return false;
        var evt2=event.getParent('phaseUse');
        if(evt2.player!=player) return false;
        return player.getHistory('useCard',function(evt){
            return evt.card.name==event.card.name&&evt.getParent('phaseUse')==evt2;
        }).indexOf(event.getParent())==0;
    },
                direct:true,
                content:function(){
        'step 0'
        player.chooseControl('摸牌_and_加伤害','cancel2').set('prompt',get.prompt2('fz_fengpo'));
        'step 1'
        if(result.control&&result.control!='cancel2'){
            player.logSkill('fengpo',trigger.target);
            var nd=trigger.target.countCards('h',{color:'red'});
            //if(result.control=='摸牌_and_加伤害'){
                player.draw(nd);
            //}
            //else{
                var trigger2=trigger.getParent();
                if(typeof trigger2.baseDamage!='number'){
                    trigger2.baseDamage=1;
                }
                trigger2.baseDamage+=nd;
            //}
        }
    },
            },
            "fz_renwang":{
                audio:"ext:无名扩展:2",
                enable:"phaseUse",
                usable:1,
                content:function(){
        var card=get.cardPile2(function(card){
            return get.name(card)=='renwang';
        });
        if(card){
          player.gain(card, "gain2");
        }else{
          var card=get.discardPile(function(card){
            return get.name(card)=='renwang';
          });
          if(card) {
            player.gain(card, "gain2");
          }
        }
    },
                ai:{
                    order:10,
                    result:{
                        player:1,
                    },
                    threaten:1.5,
                },
            },
            "fz_haodou":{
                group:["fz_haodou_1","fz_haodou_2"],
                subSkill:{
                    "1":{
                        audio:2,
                        trigger:{
                            player:"phaseUseBegin",
                        },
                        filter:function(event,player,target){
                return player!=target;
            },
                        content:function (){
                "step 0"
                player.chooseTarget('请选择至多三名角色视为使用决斗',[1,3],function(card,player,target){
                    return player!=target;
                }).ai=function(target){
                    var playerSha=player.countCards('h',{name:'sha'});
                    var targetHand=target.countCards('h');
                    if(playerSha==0){
                        return get.attitude(player,target)<0&&(targetHand/3.64)<2;
                    }
                    return get.attitude(player,target)<0&&(targetHand/3.64)<=(playerSha*2);
                };
                "step 1"
                if(result.bool){
                    player.useCard({name:'juedou'},result.targets,false);
                }
            },
                        direct:true,
                        ai:{
                            threaten:1.6,
                            expose:0.2,
                        },
                        sub:true,
                    },
                    "2":{
                        audio:2,
                        trigger:{
                            player:"useCardAfter",
                        },
                        frequent:true,
                        filter:function(event,player){
                return get.type(event.card)=='equip';
            },
                        content:function(){
                "step 0"
                player.chooseTarget('请选择一名其他角色视为使用决斗',function(card,player,target){
                    return player!=target;
                }).ai=function(target){
                    var playerSha=player.countCards('h',{name:'sha'});
                    var targetHand=target.countCards('h');
                    if(playerSha==0){
                        return get.attitude(player,target)<0&&(targetHand/3.64)<2;
                    }
                    return get.attitude(player,target)<0&&(targetHand/3.64)<=(playerSha*2);
                };
                "step 1"
                if(result.bool){
                    player.useCard({name:'juedou'},result.targets,false);
                }
            },
                        sub:true,
                    },
                },
            },
            "fz_wanglie":{
                locked:false,
                mod:{
                    targetInRange:function(card,player,target,now){
            if(game.online){
                if(!player.countUsed()) return true;
            }
            else{
                var evt=_status.event.getParent('phaseUse');
                if(evt&&evt.name=='phaseUse'&&player.getHistory('useCard',function(evt2){
                    return evt2.getParent('phaseUse')==evt
                }).length==0) return true;
            }
        },
                },
                audio:"ext:无名扩展:2",
                trigger:{
                    player:"useCard",
                },
                filter:function(event,player){
        return player.isPhaseUsing()&&(event.card.name=='sha'||get.type(event.card)=='trick');
    },
                preHidden:true,
                check:function(event,player){
        if(['wuzhong','kaihua','dongzhuxianji'].contains(event.card.name)) return false;
        if(['sha'].contains(event.card.name)) return true;
        player._wanglie_temp=true;
        var eff=0;
        for(var i of event.targets){
            eff+=get.effect(i,event.card,player,player);
        }
        delete player._wanglie_temp;
        if(eff<0) return true;
        if(!player.countCards('h',function(card){
            return player.hasValueTarget(card,null,true);
        })) return true;
        if(get.tag(event.card,'damage')&&!player.needsToDiscard()&&!player.countCards('h',function(card){
            return get.tag(card,'damage')&&player.hasValueTarget(card,null,true);
        })) return true;
        return false;
    },
                "prompt2":function(event){
        return '令'+get.translation(event.card)+'不能被响应，然后本回合不能再使用牌'
    },
                content:function(){
        trigger.nowuxie=true;
        trigger.directHit.addArray(game.players);
        player.addTempSkill('drlt_wanglie2');
    },
                ai:{
                    pretao:true,
                    "directHit_ai":true,
                    skillTagFilter:function(player,tag,arg){
            if(tag=='pretao') return true;
            if(player._wanglie_temp) return false;
            player._wanglie_temp=true;
            var bool=function(){
                if(['wuzhong','kaihua','dongzhuxianji'].contains(arg.card.name)) return false;
                if(get.attitude(player,arg.target)>0||!player.isPhaseUsing()) return false;
                var cards=player.getCards('h',function(card){
                    return card!=arg.card&&(!arg.card.cards||!arg.card.cards.contains(card));
                });
                var sha=player.getCardUsable('sha');
                if(arg.card.name=='sha') sha--;
                cards=cards.filter(function(card){
                    if(card.name=='sha'&&sha<=0) return false;
                    return player.hasValueTarget(card,null,true);
                });
                if(!cards.length) return true;
                if(!get.tag(arg.card,'damage')) return false;
                if(!player.needsToDiscard()&&!cards.filter(function(card){
                    return get.tag(card,'damage');
                }).length) return true;
                return false;
            }();
            delete player._wanglie_temp;
            return bool;
        },
                },
            },
            "fz_fangzhu":{
                audio:"ext:无名扩展:2",
                trigger:{
                    source:"damageEnd",
                },
                check:function(trigger,player){
        return get.attitude(player,trigger.player)<0;
    },
                filter:function(trigger,player){
        return trigger.player.isAlive();
    },
                content:function (){
        "step 0"
        player.logSkill('fangzhu',trigger.player);
        trigger.player.judge();
        "step 1"
        if(result.suit){
            if(result.suit!='diamond'){
                if(!trigger.player.classList.contains('turnedover')){                
                    trigger.player.turnOver();
                }
            }
        }
    },
                ai:{
                    threaten:1.6,
                    expose:0.2,
                },
            },
            "fz_shuangsha":{
                mod:{
                    selectTarget:function(card,player,range){
            if(range[1]==-1) return;
            if(card.name=='sha') range[1]+=1;
        },
                },
            },
            "fz_liegong":{
                shaRelated:true,
                mod:{
                    targetInRange:function(card,player,target){
            if(card.name=='sha'&&typeof get.number(card)=='number'){
                if(get.distance(player,target)<=get.number(card)) return true;
            }
        },
                },
                audio:"liegong",
                audioname:["re_huangzhong"],
                trigger:{
                    player:"useCardToTargeted",
                },
                logTarget:"target",
                check:function(event,player){
        return get.attitude(player,event.target)<=0;
    },
                filter:function(event,player){
        if(event.card.name!='sha') return false;
        if(event.target.countCards('h')<=player.countCards('h')) return true;
        if(event.target.hp>=player.hp) return true;
        return false;
    },
                content:function(){
        if(trigger.target.countCards('h')<=player.countCards('h')) {
            //trigger.getParent().directHit.push(trigger.target);
            var id=trigger.target.playerid;
            var map=trigger.getParent().customArgs;
            if(!map[id]) map[id]={};
            if(typeof map[id].extraDamage!='number'){
                map[id].extraDamage=0;
            }
            map[id].extraDamage++;
            if(trigger.target.countCards('h')>0){
                player.discardPlayerCard(trigger.target,'h',false)
                    .set('att',get.attitude(player,trigger.target)<=0);
            }
        }
        if(trigger.target.hp>=player.hp){
            trigger.getParent().directHit.push(trigger.target);
            var id=trigger.target.playerid;
            var map=trigger.getParent().customArgs;
            if(!map[id]) map[id]={};
            if(typeof map[id].extraDamage!='number'){
                map[id].extraDamage=0;
            }
            map[id].extraDamage=map[id].extraDamage+2;
        }
    },
                ai:{
                    threaten:0.5,
                    "directHit_ai":true,
                    skillTagFilter:function(player,tag,arg){
            if(get.attitude(player,arg.target)<=0&&arg.card.name=='sha'&&player.hp<=arg.target.hp) return true;
            return false;
        },
                },
            },
            "fz_quedi":{
                audio:"ext:无名扩展:2",
                trigger:{
                    player:"useCardToPlayered",
                },
                direct:true,
                usable:2,
                filter:function(event,player){
        return (event.card.name=='sha'||event.card.name=='juedou')&&event.targets.length==1&&
        (event.target.countGainableCards(player,'h')>0||player.hasCard(function(i){
            return _status.connectMode||get.type(i,player)=='basic'&&lib.filter.cardDiscardable(i,player,'dbquedi');
        },'h'));
    },
                content:function(){
        'step 0'
        var target=trigger.target;
        event.target=target;
        var list=[];
        if(target.countGainableCards(player,'h')>0) list.push('选项一');
        if(player.hasCard(function(i){
            return get.type(i,player)=='basic'&&lib.filter.cardDiscardable(i,player,'dbquedi');
        },'h')) list.push('选项二');
        list.push('背水！');
        list.push('cancel2');
        player.chooseControl(list).set('choiceList',[
            '获得'+get.translation(target)+'的一张手牌',
            '弃置一张基本牌并令'+get.translation(trigger.card)+'伤害+1',
            '背水！减1点体力上限并执行所有选项',
        ]).set('prompt',get.prompt('dbquedi',target)).set('ai',function(){
            var evt=_status.event.getTrigger(),player=evt.player,target=evt.target,card=evt.card;
            if(get.attitude(player,target)>0) return 'cancel2';
            var bool1=target.countGainableCards(player,'h')>0;
            var bool2=player.hasCard(function(i){
                return get.type(i,player)=='basic';
            },'h');
            if(bool1&&bool2&&player.isDamaged()) return '背水！';
            if(bool1) return '选项一';
            if(bool2) return '选项二';
            return 'cancel2';
        });
        'step 1'
        if(result.control!='cancel2'){
            player.logSkill('dbquedi',target);
            event.control=result.control;
            if(event.control=='背水！') player.loseMaxHp();
        }
        else{
            player.storage.counttrigger.fz_quedi--;
            event.finish();
        }
        'step 2'
        if((event.control=='选项一'||event.control=='背水！')&&target.countGainableCards(player,'h')>0) player.gainPlayerCard(target,true,'h');
        'step 3'
        if((event.control=='选项二'||event.control=='背水！')&&player.hasCard(function(i){
            return get.type(i,player)=='basic'&&lib.filter.cardDiscardable(i,player,'dbquedi');
        },'h')){
            player.chooseToDiscard('h','弃置一张基本牌',{type:'basic'},true);
        }
        else event.finish();
        'step 4'
        if(result.bool) trigger.getParent().baseDamage++;
    },
                ai:{
                    "directHit_ai":true,
                    skillTagFilter:function(player,tag,arg){
            if(!arg||!arg.card||!arg.target||(arg.card.name!='sha'&&arg.card.name!='juedou')) return false;
            if(player.storage.counttrigger&&player.storage.counttrigger.fz_quedi&&player.storage.counttrigger.fz_quedi>0) return false;
            if(arg.target.countCards('h')==1&&(arg.card.name!='sha'||!arg.target.getEquip('bagua')||player.hasSkillTag('unequip',false,{
                name:arg.card?arg.card.name:null,
                target:arg.target,
                card:arg.card
            })||player.hasSkillTag('unequip_ai',false,{
                name:arg.card?arg.card.name:null,
                target:arg.target,
                card:arg.card
            }))) return true;
            return false;
        },
                },
            },
            "fz_mosha":{
                audio:"ext:无名扩展:2",
                enable:"phaseUse",
                usable:1,
                content:function(){
        'step 0'
        player.judge();
        'step 1'
        if(result.color=='red'){
            var card=get.cardPile2(function(card){
                return get.name(card)=='sha';
            });
            if(card){
              player.gain(card, "gain2");
            }else{
              var card=get.discardPile(function(card){
                return get.name(card)=='sha';
              });
              if(card) {
                player.gain(card, "gain2");
              }
            }
        }
    },
                ai:{
                    order:10,
                    result:{
                        player:1,
                    },
                    threaten:1.5,
                },
            },
            "fz_bingliang":{
                audio:"ext:无名扩展:2",
                enable:"chooseToUse",
                filterCard:function(card){
         return (get.color(card)=='black');
    },
                filter:function(event,player){
        return player.hasCard((card)=>(get.color(card)=='black'),'hes');
    },
                position:"hes",
                viewAs:{
                    name:"bingliang",
                },
                prompt:"将一张黑色牌当做兵粮寸断使用",
                check:function(card){return 6-get.value(card)},
                ai:{
                    order:9,
                    basic:{
                        order:1,
                        useful:1,
                        value:4,
                    },
                    result:{
                        target:function(player,target){
                if(target.hasJudge('caomu')) return 0;
                return -1.5/Math.sqrt(target.countCards('h')+1);
            },
                    },
                    tag:{
                        skip:"phaseDraw",
                    },
                },
                mod:{
                    targetInRange:function(card,player,target){
            if(card.name=='bingliang') return true;
        },
                },
            },
            "fz_lebu":{
                audio:"ext:无名扩展:2",
                filter:function(event,player){
        return player.countCards('hes',{color:'red'})>0;
    },
                enable:"chooseToUse",
                filterCard:function(card){
        return get.color(card)=='red';
    },
                position:"hes",
                viewAs:{
                    name:"lebu",
                },
                prompt:"将一张红色牌当乐不思蜀使用",
                check:function(card){return 9-get.value(card)},
                ai:{
                    threaten:1.5,
                    basic:{
                        order:1,
                        useful:1,
                        value:8,
                    },
                    result:{
                        ignoreStatus:true,
                        target:function(player,target){
                var num=target.hp-target.countCards('h')-2;
                if(num>-1) return -0.01;
                if(target.hp<3) num--;
                if(target.isTurnedOver()) num/=2;
                var dist=get.distance(player,target,'absolute');
                if(dist<1) dist=1;
                return num/Math.sqrt(dist)*get.threaten(target,player);
            },
                    },
                    tag:{
                        skip:"phaseUse",
                    },
                },
            },
            "fz_hongsha":{
                audio:"ext:无名扩展:2",
                enable:"phaseUse",
                usable:1,
                content:function(){
        var card=get.cardPile2(function(card){
            return get.name(card)=='sha'&&get.color(card)=='red';
        });
        if(card){
          player.gain(card, "gain2");
        }else{
          var card=get.discardPile(function(card){
            return get.name(card)=='sha'&&get.color(card)=='red';
          });
          if(card) {
            player.gain(card, "gain2");
          }
        }
    },
                ai:{
                    order:10,
                    result:{
                        player:1,
                    },
                    threaten:1.5,
                },
            },
            "fz_zhishi":{
                audio:"shuishi",
                enable:"phaseUse",
                usable:1,
                filter:function(event,player){
        return player.maxHp<9;
    },
                content:function(){
        'step 0'
        player.judge();
        'step 1'
        if(result.suit=='spade'){
            player.gainMaxHp();
            player.draw(3);
        }
        if(result.suit=='heart'){
            player.gainMaxHp(2);
            player.draw(2);
        }
        if(result.suit=='club'){
            player.gainMaxHp(3);
            player.draw();
        }
        if(result.suit=='diamond'){
            player.gainMaxHp(4);
        }
        'step 2'
        if(player.maxHp>9) player.loseMaxHp(player.maxHp-9);
    },
                ai:{
                    order:1,
                    result:{
                        player:1,
                    },
                },
            },
            "fz_guding":{
                group:["fz_guding_1","fz_guding_2","fz_guding_3"],
                subSkill:{
                    "1":{
                        audio:"ext:无名扩展:2",
                        enable:"phaseUse",
                        usable:1,
                        content:function(){
                var card=get.cardPile2(function(card){
                    return get.name(card)=='guding';
                });
                if(card){
                      player.gain(card, "gain2");
                }else{
                    var card=get.discardPile(function(card){
                        return get.name(card)=='guding';
                    });
                      if(card) {
                        player.gain(card, "gain2");
                      }
                }
            },
                        ai:{
                            order:10,
                            result:{
                                player:1,
                            },
                            threaten:1.5,
                        },
                        sub:true,
                    },
                    "2":{
                        shaRelated:true,
                        filter:function(event,player){
                var num=player.countCards("e",function(card){ 
                    return card.name=="guding"; 
                });
                if(event.card.name=='sha'&&num>0&&player!=event.target) return true;
                return false;
            },
                        logTarget:"target",
                        check:function(event,player){
                return get.attitude(player,event.target)<=0;
            },
                        trigger:{
                            player:"useCardToTargeted",
                        },
                        content:function(){
                var id=trigger.target.playerid;
                var map=trigger.getParent().customArgs;
                if(!map[id]) map[id]={};
                if(typeof map[id].extraDamage!='number'){
                    map[id].extraDamage=0;
                }
                map[id].extraDamage=map[id].extraDamage+1;
            },
                        sub:true,
                    },
                    "3":{
                        shaRelated:true,
                        filter:function(event,player){
                if(event.card.name=='sha'&&player!=event.target) return true;
                return false;
            },
                        logTarget:"target",
                        check:function(event,player){
                return get.attitude(player,event.target)<=0;
            },
                        trigger:{
                            player:"useCardToTargeted",
                        },
                        content:function(){
                'step 0'
                player.judge();
                'step 1'
                //if(result.color){
                //    if(_status.currentPhase==player){
                //        if(!player.storage.fz_guding2) player.storage.fz_guding2=0;
                //        player.storage.fz_guding2+=1;
                //        player.addTempSkill('fz_guding2',{player:'phaseAfter'});
                //    }
                //}
                if(result.suit=='diamond'){
                    if(_status.currentPhase==player){
                        if(!player.storage.fz_guding2) player.storage.fz_guding2=0;
                        player.storage.fz_guding2+=1;
                        player.addTempSkill('fz_guding2',{player:'phaseAfter'});
                    }
                }
                if(result.suit=='heart'){
                    player.recover();
                }
                if(result.suit=='spade'){
                    var trigger2=trigger.getParent();
                    if(typeof trigger2.baseDamage!='number'){
                        trigger2.baseDamage=1;
                    }
                    trigger2.baseDamage+=1;
                }
                if(result.suit=='club'){
                    player.discardPlayerCard(trigger.target,'he', true);
                }
            },
                        sub:true,
                    },
                },
            },
            "fz_juedou":{
                audio:"shuangxiong",
                trigger:{
                    player:"phaseJieshuBegin",
                },
                filter:function(event,player,target){
        return target!=player;
    },
                content:function (){
        "step 0"
         player.chooseTarget('请选择一名角色视为使用决斗',function(card,player,target){
           return player!=target;
         }).ai=function(target){
           return get.attitude(player,target)<0&&(player.countCards('h')>=target.countCards('h')||player.hp>1);
         };
        "step 1"
        if(result.bool){
            player.useCard({name:'juedou'},'nowuxie',result.targets,false);
        }
    },
                ai:{
                    threaten:1.6,
                    expose:0.2,
                },
            },
            "fz_tuji":{
                audio:"retuxi",
                trigger:{
                    player:"phaseDrawBegin2",
                },
                direct:true,
                preHidden:true,
                filter:function(event,player){
        return event.num>0&&!event.numFixed&&game.hasPlayer(function(target){
            return target.countCards('h')>0&&player!=target;
        });
    },
                content:function (){
        "step 0"
        var num=get.copy(trigger.num);
        if(get.mode()=='guozhan'&&num>2) num=2;
        player.chooseTarget('是否发动【突击】？','获得至多'+get.translation(num)+'名角色的各一张手牌，然后少摸等量的牌并视为对这些角色使用一张【杀】',[1,num],function(card,player,target){
            return target.countCards('h')>0&&player!=target;
        },function(target){
            var att=get.attitude(_status.event.player,target);
            if(target.hasSkill('tuntian')) return att/10;
            return 1-att;
        }).setHiddenSkill('new_retuxi');
        "step 1"
        if(result.bool){
            result.targets.sortBySeat();
            player.logSkill('new_retuxi',result.targets);
            player.gainMultiple(result.targets);
            //var tl=result.targets.length;
            //for(var i=0;i<tl;i++){
            //    result.targets[i].damage()
            //}                                                
            player.useCard({name:'sha'},result.targets,false);
            trigger.num-=result.targets.length;
        }
        else{
            event.finish();
        }
        "step 2"
        if(trigger.num<=0) game.delay();
    },
                ai:{
                    threaten:1.6,
                    expose:0.2,
                },
            },
            "fz_chedian":{
                group:"xinleiji_misa",
                audio:"ext:无名扩展:2",
                derivation:"xinleiji_faq",
                audioname:["boss_qinglong"],
                trigger:{
                    player:["useCard","respond"],
                },
                filter:function(event,player){
        return event.card.name=='shan'||event.card.name=='sha'||event.name=='useCard'&&event.card.name=='shandian';
    },
                judgeCheck:function(card,bool){
        var suit=get.suit(card);
        if(suit=='spade'){
            if(bool&&get.number(card)>1&&get.number(card)<10) return 5;
            return 4;
        }
        if(suit=='club') return 2;
        return 0;
    },
                content:function(){
        player.judge(lib.skill.xinleiji.judgeCheck).judge2=function(result){
            return result.bool?true:false;
        };
    },
                ai:{
                    useShan:true,
                    effect:{
                        target:function(card,player,target,current){
                if(get.tag(card,'respondShan')&&!player.hasSkillTag('directHit_ai',true,{
                    target:target,
                    card:card,
                },true)){
                    var hastarget=game.hasPlayer(function(current){
                        return get.attitude(target,current)<0;
                    });
                    var be=target.countCards('e',{color:'black'});
                    if(target.countCards('h','shan')&&be){
                        if(!target.hasSkill('xinguidao')) return 0;
                        return [0,hastarget?target.countCards('he')/2:0];
                    }
                    if(target.countCards('h','shan')&&target.countCards('h')>2){
                        if(!target.hasSkill('xinguidao')) return 0;
                        return [0,hastarget?target.countCards('h')/4:0];
                    }
                    if(target.countCards('h')>3||(be&&target.countCards('h')>=2)){
                        return [0,0];
                    }
                    if(target.countCards('h')==0){
                        return [1.5,0];
                    }
                    if(target.countCards('h')==1&&!be){
                        return [1.2,0];
                    }
                    if(!target.hasSkill('xinguidao')) return [1,0.05];
                    return [1,Math.min(0.5,(target.countCards('h')+be)/4)];
                }
            },
                    },
                },
            },
            "fz_shuangdao":{
                mod:{
                    cardUsable:function(card,player,num){
            if(card.name=='sha') return num+1;
        },
                },
            },
            "fz_jimou":{
                audio:"ext:无名扩展:2",
                trigger:{
                    player:"phaseUseBegin",
                },
                skillAnimation:true,
                animationColor:"orange",
                content:function(){
        'step 0'
        var num=player.hp-1;
        if(player.countCards('hs',{name:['tao','jiu']})){
            num=player.hp;
        }
        var map={};
        var list=[];
        for(var i=1;i<=player.hp;i++){
            var cn=get.cnNumber(i,true);
            map[cn]=i;
            list.push(cn);
        }
        event.map=map;
        player.chooseControl(list,function(){
            return get.cnNumber(_status.event.goon,true);
        }).set('prompt','失去任意点体力').set('goon',num);
        'step 1'
        var num=event.map[result.control]||1;
        player.storage.reqimou2=num;
        player.loseHp(num);
        player.draw(num);
        player.addTempSkill('reqimou2');
    },
                ai:{
                    order:14,
                    result:{
                        player:function(player){
                if(player.hp<3) return false;
                var mindist=player.hp;
                if(player.countCards('hs',{name:['tao','jiu']})) mindist++;
                if(game.hasPlayer(function(current){
                    return (get.distance(player,current)<=mindist&&
                        player.canUse('sha',current,false)&&
                        get.effect(current,{name:'sha'},player,player)>0);
                })){
                    return 1;
                }
                return 0;
            },
                    },
                },
            },
            "fz_chaofeng":{
                enable:"phaseUse",
                usable:2,
                filterTarget:function(card,player,target){
        return player.canCompare(target);
    },
                selectTarget:[1,3],
                filter:function(event,player){
        return player.countCards('h')>0;
    },
                multitarget:true,
                multiline:true,
                content:function(){
        player.logSkill('chaofeng',targets);
        for(var i=0;i<targets.length;i++){
            if(!targets[i].isLinked()){
                targets[i].link(true);
            }
        }
        player.chooseToCompare(targets).callback=lib.skill.fz_chaofeng.callback;
    },
                callback:function(){
        if(event.num1>event.num2){
            player.useCard({
                    name:'sha',
                    nature:'fire'
                    },target,false);
        }
    },
                ai:{
                    order:9,
                    result:{
                        player:function(player){
                return 1;
            },
                        target:function(player,target){
                return -1;
            },
                    },
                },
            },
            "fz_test":{
                group:["fz_test_1"],
                subSkill:{
                    "1":{
                        enable:"phaseUse",
                        usable:1,
                        content:function(){
                var card=get.cardPile2(function(card){
                    return get.name(card)=='zhuge';
                });
                if(card){
                  player.gain(card, "gain2");
                }else{
                  var card=get.discardPile(function(card){
                    return get.name(card)=='zhuge';
                  });
                  if(card) {
                    player.gain(card, "gain2");
                  }
                }
            },
                        ai:{
                            order:10,
                            result:{
                                player:1,
                            },
                            threaten:1.5,
                        },
                        sub:true,
                    },
                },
            },
            "fz_fuji":{
                audio:"fuqi",
                forced:true,
                trigger:{
                    player:"useCard",
                },
                filter:function(event,player){
        return event.card&&(get.type(event.card)=='trick'||get.type(event.card)=='basic'&&!['shan','tao','jiu','du'].contains(event.card.name))&&game.hasPlayer(function(current){
            return current!=player&&current.inRange(player);
        });
    },
                content:function(){
        trigger.directHit.addArray(game.filterPlayer(function(current){
            return current!=player&&current.inRange(player);
        }));
    },
                ai:{
                    "directHit_ai":true,
                    skillTagFilter:function(player,tag,arg){
            return arg.target.inRange(player);
        },
                },
            },
            "fz_jiaozi":{
                forced:true,
                audio:"jiaozi",
                trigger:{
                    player:"useCard",
                },
                filter:function(event,player){
        return true;
    },
                content:function(){},
                group:["fz_jiaozi_1","fz_jiaozi_2","fz_jiaozi_3"],
                subSkill:{
                    "1":{
                        audio:"jiaozi",
                        trigger:{
                            source:"damageBegin1",
                        },
                        forced:true,
                        filter:function(event,player){
                return player&&event.player&&player.hp>event.player.hp;
            },
                        content:function(){
                trigger.num=trigger.num+1;
            },
                        ai:{
                            presha:true,
                        },
                        sub:true,
                    },
                    "2":{
                        audio:"jiaozi",
                        trigger:{
                            player:"damageBegin3",
                        },
                        forced:true,
                        filter:function(event,player){
                return player&&event.source&&player.hp>event.source.hp;
            },
                        content:function(){
                trigger.num=trigger.num+1;
            },
                        ai:{
                            presha:true,
                        },
                        sub:true,
                    },
                    "3":{
                        audio:"jiaozi",
                        trigger:{
                            source:"damageBegin3",
                        },
                        forced:true,
                        filter:function(event,player){
                return player&&event.player&&player.hp<=event.player.hp;
            },
                        content:function(){
                player.recover();
            },
                        ai:{
                            presha:true,
                        },
                        sub:true,
                    },
                },
            },
            "fz_zhiheng":{
                audio:"rezhiheng",
                audioname:["gz_jun_sunquan"],
                enable:"phaseUse",
                usable:1,
                position:"he",
                filterCard:true,
                selectCard:[1,Infinity],
                prompt:"弃置任意张牌，然后摸双倍量的牌",
                check:function(card,player,trigger){
        if(get.name(card)=='zhuge'&&get.suit(card)=='club') return -1;
        if(get.name(card)=='tao'&&get.suit(card)=='heart') return -1;
        if(get.name(card)=='chitu') return -1;
        return 9-get.value(card)
    },
                content:function(){
        player.draw(cards.length*2);
    },
                ai:{
                    order:6,
                    result:{
                        player:3,
                    },
                    threaten:1.5,
                },
            },
            "fz_choujue":{
                audio:"ext:纷争扩展:2",
                trigger:{
                    source:"dieAfter",
                },
                forced:true,
                content:function(){
        player.gainMaxHp();
        player.draw(2);
        player.addSkill('counttrigger');
        if(!player.storage.counttrigger) player.storage.counttrigger={};
        if(!player.storage.counttrigger.fz_quedi) player.storage.counttrigger.fz_quedi=0;
        player.storage.counttrigger.fz_quedi--;
    },
            },
            "fz_xuenu":{
                audio:"kuanggu",
                group:["fz_xuenu_1"],
                direct:true,
                global:"fz_xuenu_mark",
                trigger:{
                    player:"useCard",
                },
                content:function(){
        "step 0"
        player.chooseTarget('请选择一名其他角色获得一枚“血祭”标记',function(card,player,target){
            return player!=target&&!target.hasMark('fz_xuenu_mark');
        }).ai=function(target){
            return 1-get.attitude(player,target);
        };
        "step 1"
        if(result.bool){
            player.logSkill('kuanggu',result.targets);
            player.line(result.targets[0],'fire');
            result.targets[0].addMark('fz_xuenu_mark',1);
        }
    },
                mod:{
                    targetInRange:function(card,player,target){
            if(target.hasMark('fz_xuenu_mark')) 
                return true;
        },
                },
                ai:{
                    threaten:3,
                    order:2,
                    result:{
                        player:1,
                        target:-1,
                    },
                },
                subSkill:{
                    "1":{
                        audio:"kuanggu",
                        direct:true,
                        trigger:{
                            player:"phaseUseBegin",
                        },
                        filter:function(event,player){
                var otherplayers=game.filterPlayer(function(current){
                    return current!=player&&current.hasMark('fz_xuenu_mark');
                });
                return otherplayers.length>0;
            },
                        content:function(){
                "step 0"
                event.current=player.next;
                event.currented=[];
                "step 1"
                event.currented.push(event.current);
                if(event.current.hasMark('fz_xuenu_mark')){
                    player.line(event.current,'fire');
                    event.current.damage();
                    if(player.isDamaged()){
                        player.recover(1);
                    }else{
                        player.gainMaxHp(1);
                    }
                    var mark=event.current.countMark('fz_xuenu_mark');
                    event.current.removeMark('fz_xuenu_mark',mark);                    
                }
                event.current=event.current.next;
                if(event.current!=player&&!event.currented.contains(event.current)){
                    game.delay(0.5);
                    event.goto(1);
                }
            },
                        sub:true,
                        ai:{
                            threaten:1.6,
                            expose:0.2,
                        },
                    },
                },
            },
            "fz_xuenu_mark":{
                marktext:"血",
                intro:{
                    name:"血祭",
                    content:"mark",
                },
                trigger:{
                    player:"phaseUseBegin",
                },
                forced:true,
                filter:function(event,player,target){
        var num=game.countPlayer(function(current){
            return current.hasSkill('fz_xuenu');
        });
        return player.hasMark('fz_xuenu_mark')&&num>0;
    },
                content:function (){
        var num=player.countMark('fz_xuenu_mark');
        var source=game.filterPlayer(function(current){
            return current.hasSkill('fz_xuenu');
        });
        player.loseHp(num);
        for(var j=0;j<source.length;j++){
            if(!source[j].isDamaged()){
                source[j].draw(num);
            }else{
                source[j].recover(num);
            }
        }
    },
            },
            "fz_hunzi":{
                skillAnimation:true,
                animationColor:"wood",
                audio:"ext:纷争扩展:2",
                juexingji:true,
                unique:true,
                trigger:{
                    player:"phaseZhunbeiBegin",
                },
                filter:function(event,player){
        return player.hp<=1&&!player.storage.fz_hunzi;
    },
                forced:true,
                content:function(){
        player.gainMaxHp();
        player.awakenSkill("fz_hunzi");
        player.storage.fz_hunzi=true;
    },
                ai:{
                    threaten:function(player,target){
            if(target.hp==1) return 2;
            return 0.5;
        },
                    maixie:true,
                    effect:{
                        target:function(card,player,target){
                if(!target.hasFriend()) return;
                if(get.tag(card,'damage')==1&&target.hp==2&&!target.isTurnedOver()&&
                _status.currentPhase!=target&&get.distance(_status.currentPhase,target,'absolute')<=3) return [0.5,1];
            },
                    },
                },
            },
            "fz_weizhen":{
                skillAnimation:true,
                animationColor:"fire",
                audio:"ext:纷争扩展:2",
                juexingji:true,
                unique:true,
                trigger:{
                    player:"useCardAfter",
                },
                filter:function(event,player){
        return get.type(event.card)=='equip'&&!player.storage.fz_weizhen;
    },
                forced:true,
                content:function(){
        player.gainMaxHp();
        player.recover();
        player.addSkill('fz_nuzhan');
        game.log(player,'获得了技能','#g【怒斩】');
        player.awakenSkill("fz_weizhen");
        player.storage.fz_weizhen=true;
    },
            },
            "fz_nuzhan":{
                shaRelated:true,
                audio:"ext:纷争扩展:2",
                trigger:{
                    player:"useCardToPlayered",
                },
                filter:function(event,player){
        return event.card.name=='sha';
    },
                check:function(trigger,player){
        return get.attitude(player,trigger.target)<0;
    },
                content:function(){
        var id=trigger.target.playerid;
        var map=trigger.getParent().customArgs;
        if(!map[id]) map[id]={};
        if(typeof map[id].extraDamage!='number'){
            map[id].extraDamage=0;
        }
        map[id].extraDamage=map[id].extraDamage+1;
    },
            },
            "fz_xinfencheng":{
                skillAnimation:"epic",
                animationColor:"gray",
                audio:"ext:纷争扩展:2",
                audioname:["re_liru"],
                enable:"phaseUse",
                filterTarget:function(card,player,target){
        return player!=target;
    },
                unique:true,
                usable:1,
                selectTarget:-1,
                multitarget:true,
                multiline:true,
                mark:true,
                line:"fire",
                content:function(){
        "step 0"
        event.num=2;
        event.targets=targets.slice(0);
        event.targets.sort(lib.sort.seat);
        "step 1"
        if(event.targets.length){
            var target=event.targets.shift();
            event.target=target;
            var res=get.damageEffect(target,player,target,'fire');
            target.chooseToDiscard('he','弃置至少'+get.cnNumber(event.num)+'张牌或受到2点火焰伤害',[num,Infinity]).set('ai',function(card){
                if(ui.selected.cards.length>=_status.event.getParent().num) return -1;
                if(_status.event.player.hasSkillTag('nofire')) return -1;
                if(_status.event.res>=0) return 6-get.value(card);
                if(get.type(card)!='basic'){
                    return 10-get.value(card);
                }
                return 8-get.value(card);
            }).set('res',res);
        }
        else{
            event.finish();
        }
        "step 2"
        if(!result.bool){
            event.target.damage(2,'fire');
            event.num=2;
        }
        else{
            event.num=result.cards.length+1;
        }
        event.goto(1);
    },
                ai:{
                    order:1,
                    result:{
                        player:function(player){
                var num=0,eff=0,players=game.filterPlayer(function(current){
                    return current!=player;
                }).sortBySeat(player);
                for(var target of players){
                    if(get.damageEffect(target,player,target,'fire')>=0){num=0;continue};
                    var shao=false;
                    num++;
                    if(target.countCards('he',function(card){
                        if(get.type(card)!='basic'){
                            return get.value(card)<10;
                        }
                        return get.value(card)<8;
                    })<num) shao=true;
                    if(shao){
                        eff-=4*(get.realAttitude||get.attitude)(player,target);
                        num=0;
                    }
                    else eff-=num*(get.realAttitude||get.attitude)(player,target)/4;
                }
                if(eff<4) return 0;
                return eff;
            },
                    },
                },
            },
            "fz_qiangxi":{
                audio:"qiangxi",
                frequent:true,
                trigger:{
                    player:"useCard",
                },
                content:function (){
        "step 0"
        player.chooseTarget('对一名其他角色造成一点伤害',function(card,player,target){
            return player!=target;
        }).ai=function(target){
            return 1-get.attitude(player,target);
        };
        "step 1"
        if(result.bool){
            player.line(result.targets[0],'fire');
            result.targets[0].damage();
        }
    },
            },
            "fz_shuangji":{
                audio:"qiangxi",
                enable:"phaseUse",
                usable:1,
                filter:function(event,player,target){
        return target!=player&&player.maxHp>2;
    },
                content:function (){
        "step 0"
         player.chooseTarget('请选择一名有装备的其他角色发动破甲',function(card,player,target){
           return player!=target&&target.countCards('e')>=1;
         }).ai=function(target){
            return get.attitude(player,target)<0;
         };
        "step 1"
        if(result.bool){
            player.line(result.targets[0],'fire');
            player.loseMaxHp(2);
            result.targets[0].loseMaxHp(2);
        }
    },
                ai:{
                    order:10,
                    result:{
                        player:1,
                    },
                    threaten:1.6,
                    expose:0.2,
                },
            },
            "fz_yongsi":{
                audio:"ext:纷争扩展:2",
                group:["fz_yongsi_1","fz_yongsi_2"],
                subSkill:{
                    "1":{
                        audio:"yongsi1",
                        trigger:{
                            player:"phaseDrawBegin2",
                        },
                        forced:true,
                        filter:function(event,player){
                return !event.numFixed;
            },
                        content:function(event,player){
                trigger.num+=game.countGroup()+player.hp;
            },
                        sub:true,
                    },
                    "2":{
                        audio:2,
                        trigger:{
                            player:"phaseDiscardBegin",
                        },
                        forced:true,
                        content:function(event,player){
                player.chooseToDiscard(game.countGroup(),'he',true);
            },
                        sub:true,
                    },
                },
            },
            "fz_qixi":{
                trigger:{
                    global:["useCard","respond"],
                },
                filter:function(event,player){
        return ((event.name=='useCard'||event.name=='respond')&&event.player==player)||(event.name=='useCard'&&(get.name(event.card)=='guohe'||event.card.name=='shunshou')&&event.player!=player);
    },
                frequent:true,
                content:function (){
        "step 0"
        player.chooseTarget('是否发动【奇袭】？','弃置一名有牌的其他角色一张牌',[1,1],function(card,player,target){
            return target.countCards('he')>0&&player!=target;
        },function(target){
            var att=get.attitude(_status.event.player,target);
            if(target.hasSkill('tuntian')) return att/10;
            return 1-att;
        })
        "step 1"
        if(result.bool){
            player.logSkill('qixi',result.targets);
            player.line(result.targets[0],'green');
            player.discardPlayerCard(result.targets[0],'he', true);                                          
        }
        else{
            event.finish();
        }
    },
                ai:{
                    threaten:1.6,
                    expose:0.2,
                },
                group:["fz_qixi_1","fz_qixi_2"],
                subSkill:{
                    "1":{
                        audio:2,
                        frequent:true,
                        filter:function(event,player){
        return event.player!=player&&event.card&&(event.card.name=='sha'||get.type(event.card)=='trick');
    },
                        logTarget:"player",
                        trigger:{
                            target:"useCardToTargeted",
                        },
                        content:function(){
        "step 0"
        player.chooseTarget('是否发动【奇袭】？','弃置一名有牌的其他角色一张牌',[1,1],function(card,player,target){
            return target.countCards('he')>0&&player!=target;
        },function(target){
            var att=get.attitude(_status.event.player,target);
            if(target.hasSkill('tuntian')) return att/10;
            return 1-att;
        })
        "step 1"
        if(result.bool){
            player.logSkill('qixi',result.targets);
            player.line(result.targets[0],'green');
            player.discardPlayerCard(result.targets[0],'he', true);                                          
        }
        else{
            event.finish();
        }
    },
                        ai:{
                            expose:0.2,
                        },
                        sub:true,
                    },
                    "2":{
                        audio:2,
                        frequent:true,
                        trigger:{
                            player:"damageEnd",
                        },
                        content:function(){
        "step 0"
        player.chooseTarget('是否发动【奇袭】？','弃置一名有牌的其他角色一张牌',[1,1],function(card,player,target){
            return target.countCards('he')>0&&player!=target;
        },function(target){
            var att=get.attitude(_status.event.player,target);
            if(target.hasSkill('tuntian')) return att/10;
            return 1-att;
        })
        "step 1"
        if(result.bool){
            player.logSkill('qixi',result.targets);
            player.line(result.targets[0],'green');
            player.discardPlayerCard(result.targets[0],'he', true);                                          
        }
        else{
            event.finish();
        }
    },
                        ai:{
                            expose:0.2,
                        },
                        sub:true,
                    },
                },
            },
            "fz_renfu":{
                audio:"ext:纷争扩展:2",
                enable:"phaseUse",
                usable:2,
                global:"fz_renfu_mark",
                content:function(){
        'step 0'
        player.chooseTarget(get.prompt('fz_renfu'),"将“父”交给一名角色；其摸牌阶段多摸一张牌，出牌阶段开始时你可以获得其一张牌。该角色回合结束后，其移去“父”标记，然后若其装备区域有牌，则你可以获得其中一张牌，否则你视为对其使用一张【杀】",function(card,player,target){
            return player!=target&&!target.hasMark('fz_renfu_mark');
        }).ai=function(target){
            return 1-get.attitude(player,target);
        };
        'step 1'
        if(result.bool){
            var target=result.targets[0];
            player.line(target);
            player.logSkill('fz_renfu',target);
            target.addMark('fz_renfu_mark',1);
        };
    },
                ai:{
                    threaten:3,
                    order:2,
                    result:{
                        player:1,
                        target:-1,
                    },
                },
                group:["fz_renfu_1","fz_renfu_2"],
                subSkill:{
                    "1":{
                        trigger:{
                            global:"phaseEnd",
                        },
                        forced:true,
                        filter:function(event,player){
                return player!=event.player&&event.player.hasMark('fz_renfu_mark')&&event.player.isAlive();
            },
                        logTarget:"player",
                        content:function(){
                if(trigger.player.countCards('e')>0){
                    player.gainPlayerCard(trigger.player,'e',true);
                } else {
                    player.useCard({name:'sha'},trigger.player,false);
                }
                trigger.player.removeMark('fz_renfu_mark',trigger.player.countMark('fz_renfu_mark'));
            },
                        sub:true,
                    },
                    "2":{
                        trigger:{
                            global:"phaseUseBegin",
                        },
                        forced:true,
                        filter:function(event,player){
                return player!=event.player&&event.player.hasMark('fz_renfu_mark')&&event.player.isAlive();
            },
                        logTarget:"player",
                        content:function(){
                if(trigger.player.countCards('he')>0){
                    player.gainPlayerCard(trigger.player,'he',true);
                }
            },
                        sub:true,
                    },
                },
            },
            "fz_renfu_mark":{
                marktext:"父",
                intro:{
                    name:"义父",
                    content:"mark",
                },
                trigger:{
                    player:"phaseDrawBegin2",
                },
                forced:true,
                filter:function(event,player,target){
        var num=game.countPlayer(function(current){
            return current.hasSkill('fz_renfu');
        });
        return player.hasMark('fz_renfu_mark')&&num>0;
    },
                content:function(){
        trigger.num+=1;
    },
            },
            "fz_hanzhan":{
                audio:"hanzhan",
                frequent:true,
                trigger:{
                    source:"damageEnd",
                },
                filter:function(event,player){
        return event.card&&event.card.name=='sha';
    },
                content:function(){
        var num=trigger.num;
        player.draw(num);
        if(_status.currentPhase==player){
            if(!player.storage.fz_hanzhan2) player.storage.fz_hanzhan2=0;
            player.storage.fz_hanzhan2+=num;
            player.addTempSkill('fz_hanzhan2',{player:'phaseAfter'});
        }
    },
            },
            "fz_hanzhan2":{
                mod:{
                    cardUsable:function(card,player,num){
            if(card.name=='sha') return num+player.storage.fz_hanzhan2;
        },
                },
                onremove:true,
            },
            "fz_zhiheng2":{
                audio:"ext:纷争扩展:2",
                unique:true,
                zhuSkill:true,
                trigger:{
                    global:"damageSource",
                },
                filter:function(event,player){
        if(player==event.source||!event.source||event.source.group!='wu') return false;
        return player.hasZhuSkill('fz_zhiheng2',event.source);
    },
                direct:true,
                content:function(){
        'step 0'
        event.count=trigger.num;
        'step 1'
        event.count--;
        trigger.source.chooseBool('是否发动【制衡】？').set('choice',get.attitude(trigger.source,player)>0);
        'step 2'
        if(result.bool){
            trigger.source.logSkill('fz_zhiheng2',player);
            player.logSkill('jiuyuan');
            player.judge();
        }
        else{
            event.finish();
        }
        'step 3'
        if(result.color=='red'){
            player.recover();
        } else if(result.color=='black'){
            if(get.position(result.card)=='d') player.gain(result.card,'gain2','log')
        }
        if(event.count) event.goto(1);
    },
            },
            "fz_hanyong":{
                audio:"qiangxi",
                trigger:{
                    source:"dieAfter",
                },
                forced:true,
                content:function(){
        player.gainMaxHp();
    },
            },
            "fz_yuyong":{
                frequent:true,
                filter:function(event,player){
                return get.name(event.card)=='juedou';
            },
                trigger:{
                    source:"damageEnd",
                },
                content:function(){
                'step 0'
                event.count=trigger.num;
                'step 1'
                event.count--;
                player.chooseBool('是否发动【愈勇】？').set('choice',get.attitude(player,player)>0);
                'step 2'
                if(result.bool){
                    player.judge();
                }
                else{
                    event.finish();
                }
                'step 3'
                if(result.suit=='diamond'){
                    player.gainMaxHp();
                }
                if(event.count) event.goto(1);
            },
            },
            "fz_shensu":{
                audio:"shensu1",
                audioname:["xiahouba","re_xiahouyuan","ol_xiahouyuan"],
                trigger:{
                    player:["phaseJudgeBegin","phaseDrawBegin2","phaseUseBegin","phaseDiscardBegin"],
                },
                frequent:true,
                content:function (){
        "step 0"
         player.chooseTarget('请选择一名角色视为使用杀',function(card,player,target){
           return player!=target;
         }).ai=function(target){
           return 1-get.attitude(player,target);
         };
        "step 1"
        if(result.bool){
          player.useCard({name:'sha'},result.targets,false);
        }
    },
                ai:{
                    threaten:1.6,
                    expose:0.2,
                },
            },
            "fz_lianpo":{
                audio:"ext:纷争扩展:2",
                frequent:true,
                trigger:{
                    source:"dieAfter",
                },
                content:function(){
        if(_status.currentPhase==player){
            if(!player.storage.fz_lianpo2) player.storage.fz_lianpo2=0;
            player.storage.fz_lianpo2+=1;
            player.addTempSkill('fz_lianpo2',{player:'phaseAfter'});
        }
    },
            },
            "fz_lianpo2":{
                mod:{
                    cardUsable:function(card,player,num){
            if(card.name=='sha') return num+player.storage.fz_lianpo2;
        },
                },
                onremove:true,
            },
            "fz_zhiheng3":{
                audio:"ext:纷争扩展:2",
                audioname:["shen_caopi"],
                enable:"phaseUse",
                usable:1,
                position:"he",
                filterCard:function(card,player,event){
        event=event||_status.event;
        if(typeof event!='string') event=event.getParent().name;
        var mod=game.checkMod(card,player,event,'unchanged','cardDiscardable',player);
        if(mod!='unchanged') return mod;
        return true;
    },
                discard:false,
                lose:false,
                delay:false,
                selectCard:[1,Infinity],
                check:function(card){
        var player=_status.event.player;
        if(get.position(card)=='h'&&!player.countCards('h','du')&&(player.hp>2||!player.countCards('h',function(card){
            return get.value(card)>=8;
        }))){
            return 1;
        }
        return 6-get.value(card)
    },
                content:function(){
        'step 0'
        player.discard(cards);
        event.num=1;
        var hs=player.getCards('h');
        if(!hs.length) event.num=0;
        for(var i=0;i<hs.length;i++){
            if(!cards.contains(hs[i])){
                event.num=0;break;
            }
        }
        'step 1'
        player.draw(event.num+cards.length);
        'step 2'
        player.chooseTarget('对一名其他角色造成伤害',function(card,player,target){
            return player!=target;
        }).ai=function(target){
            return 1-get.attitude(player,target);
        };
        'step 3'
        if(result.bool){
            player.line(result.targets[0],'fire');
            result.targets[0].damage(event.num);
        }
    },
                subSkill:{
                    draw:{
                        trigger:{
                            player:"loseEnd",
                        },
                        silent:true,
                        filter:function(event,player){
                if(event.getParent(2).skill!='rezhiheng'&&event.getParent(2).skill!='jilue_zhiheng') return false;
                if(player.countCards('h')) return false;
                for(var i=0;i<event.cards.length;i++){
                    if(event.cards[i].original=='h') return true;
                }
                return false;
            },
                        content:function(){
                player.addTempSkill('rezhiheng_delay',trigger.getParent(2).skill+'After');
            },
                        sub:true,
                        forced:true,
                        popup:false,
                    },
                    delay:{
                        sub:true,
                    },
                },
                ai:{
                    order:2,
                    result:{
                        player:1,
                    },
                    threaten:1.55,
                },
            },
            "fz_guding2":{
                mod:{
                    cardUsable:function(card,player,num){
            if(card.name=='sha') return num+player.storage.fz_guding2;
        },
                },
                onremove:true,
            },
        },
        translate:{
            "fz_bingle":"兵乐",
            "fz_bingle_info":"你可以将一张红色牌当做【乐不思蜀】使用。你可以将一张黑色牌当做【兵粮寸断】使用。你使用【兵粮寸断】无距离限制。",
            "fz_yijue":"义绝",
            "fz_yijue_info":"当你用【杀】指定一名其他角色后，该角色不能使用或打出牌，非锁定技失效且受到来自你的红桃【杀】的伤害+1直到回合结束，若该角色体力值不小于你，则此【杀】伤害+1。",
            "fz_qianxi":"潜袭",
            "fz_qianxi_info":"当你使用【杀】对目标角色造成X点伤害时，若目标体力上限大于1，你可以防止此伤害，令其减少X点体力上限，若X不小于其体力上限，则将X调整为其体力上限值减一。",
            "fz_xianjing":"陷阱",
            "fz_xianjing_info":"出牌阶段限两次，你可以与一名角色拼点。若你赢，你对其造成拼点牌点数之差一半（向上取整）的伤害，若你没赢，你可以获得其装备区域的一张牌。",
            "fz_bizhong":"必中",
            "fz_bizhong_info":"当你使用【杀】指定目标后，若目标体力上限大于1，你可以令你的【杀】无法被【闪】响应。",
            "fz_bawang":"霸王",
            "fz_bawang_info":"你可以将一张梅花牌当作决斗使用。",
            "fz_qiangshu":"枪术",
            "fz_qiangshu_info":"当你使用【杀】指定目标后，你可以令此【杀】的伤害值基数+X。（X为目标手牌中不同花色的数量）",
            "fz_yingzi":"英姿",
            "fz_yingzi_info":"锁定技，摸牌阶段，你以下的数值每满足一项你多摸一张牌，且本回合手牌上限+1：1你的手牌数不少于2；2.你的体力值不低于2；3.你装备区的牌数不低于1。",
            "fz_miansha":"面纱",
            "fz_miansha_info":"主公技，当你受到大于2点的伤害时，若场上角色数大于5，你可以亮出牌堆顶的一张牌，若此牌为红色，你减免1点伤害。",
            "fz_yongdi":"拥嫡",
            "fz_yongdi_info":"限定技，准备阶段开始时，你可令一名其他角色增加一点体力上限并回复1点体力，然后若该角色的武将牌上有主公技且其不为主公，其获得此主公技。",
            "fz_luanwu":"乱武",
            "fz_luanwu_info":"出牌阶段限两次，你可令除你外的所有角色依次对与其距离最近的另一名角色使用一张【杀】，否则失去1点体力。",
            "fz_qizheng":"奇正",
            "fz_qizheng_info":"出牌阶段限一次，你可以选择至多三名其他角色，视为对其使用一张【奇正相生】。",
            "fz_jinnang":"锦囊",
            "fz_jinnang_info":"出牌阶段限一次，你可以获得一张普通锦囊牌。",
            "fz_tianlei":"天雷",
            "fz_tianlei_info":"一名角色判定阶段开始时，若其判定区没有【闪电】，你可以令其判定，若结果为黑桃2至黑桃9，则你对其造成3点雷电伤害。",
            "fz_huaibeng":"坏崩",
            "fz_huaibeng_info":"结束阶段，若你的体力是全场最多的(唯一的)，你须减1点体力。",
            "fz_liji":"力击",
            "fz_liji_info":"你的出牌阶段，若本回合内进入过弃牌堆的卡牌数不小于3，你可以弃置一张牌并对一名其他角色造成1点伤害。",
            "fz_nuhou":"怒吼",
            "fz_nuhou_info":"出牌阶段限一次，你可以选择一名其他角色，视为对其使用一张无距离限制的【杀】；当你对其他角色使用一张【杀】后，你可以进行一次判定，若结果为红色，则你视为对该角色使用一张【杀】。",
            "fz_duodao":"夺刀",
            "fz_duodao_info":"出牌阶段限一次，你可以获得一名其他角色装备区内的一张武器牌。",
            "fz_fengpo":"凤魄",
            "fz_fengpo_info":"每种牌名限一次，当你于出牌阶段内第一次使用【杀】或【决斗】指定目标后，若目标角色数为1，你可以选择两项：1.摸X张牌；2.令此牌的伤害值基数+X。（X为其手牌中红色牌的数量）",
            "fz_renwang":"仁王",
            "fz_renwang_info":"出牌阶段限一次，你可以从牌堆或弃牌堆获得【仁王盾】。",
            "fz_haodou":"好斗",
            "fz_haodou_info":"出牌阶段开始时，你可以选择至多三个其他角色，视为对这些角色使用【决斗】；当你使用一张装备牌后，你可以选择一名其他角色视为使用一张【决斗】。",
            "fz_wanglie":"往烈",
            "fz_wanglie_info":"出牌阶段，你使用的第一张牌无距离限制；当你于回合内使用牌时，你可以令此牌不能被响应，若如此做，本回合内你不能再使用牌",
            "fz_fangzhu":"放逐",
            "fz_fangzhu_info":"当你对一名角色造成伤害后，你可以令该角色进行一次判定，若结果不为方片且该角色没有被翻面，该角色翻面。",
            "fz_shuangsha":"双杀",
            "fz_shuangsha_info":"锁定技，你使用【杀】指定的目标数上限+1。",
            "fz_liegong":"烈弓",
            "fz_liegong_info":"你使用【杀】可以选择你距离不大于此【杀】点数的角色为目标；当你使用【杀】指定一个目标后，你可以根据下列条件执行相应的效果：1.其手牌数小于等于你的手牌数，你可以弃置其一张手牌，此【杀】伤害+1。2.其体力值大于等于你的体力值，此【杀】不可被【闪】响应，此【杀】伤害+2。",
            "fz_quedi":"却敌",
            "fz_quedi_info":"每回合限两次。当你使用【杀】或【决斗】指定唯一目标后，你可选择：①获得目标角色的一张手牌。②弃置一张基本牌，并令此牌的伤害值基数+1。③背水：减1点体力上限，然后依次执行上述所有选项。",
            "fz_mosha":"摸杀",
            "fz_mosha_info":"出牌阶段限一次，你可以进行一次判定，若结果为红色，则你从牌堆或弃牌堆获得一张【杀】。",
            "fz_bingliang":"兵粮",
            "fz_bingliang_info":"你可以将一张黑色牌当做【兵粮寸断】使用。你使用【兵粮寸断】无距离限制。",
            "fz_lebu":"乐不",
            "fz_lebu_info":"你可以将一张红色牌当做【乐不思蜀】使用。",
            "fz_hongsha":"红杀",
            "fz_hongsha_info":"出牌阶段限一次，你可以从牌堆或弃牌堆获得一张红色的【杀】。",
            "fz_zhishi":"知识",
            "fz_zhishi_info":"出牌阶段限一次，若你的体力上限小于9，你可以进行一次判定，若结果为：【黑桃】你增加1点体力值上限，摸3张牌；【红桃】你增加2点体力值上限，摸2张牌；【梅花】你增加3点体力值上限，摸1张牌；【方片】你增加4点体力值上限。然后若你的体力上限大于9，则将你的体力值上限调整为9。",
            "fz_guding":"古锭",
            "fz_guding_info":"出牌阶段限一次，你可以从牌堆或弃牌堆获得【古锭刀】；当你用【杀】指定一名其他角色后，若你装备着【古锭刀】，你可以令此【杀】伤害+1；当你用【杀】指定一名其他角色后，你可以进行一次判定，若结果为：方片，你可以多出一张杀；红桃，你回复一点体力；黑桃，此杀伤害加一；草花，你弃置该角色一张牌。",
            "fz_juedou":"决斗",
            "fz_juedou_info":"结束阶段，你可以选择一名其他角色，视为对其使用一张【决斗】（不可被【无懈可击】响应）。",
            "fz_tuji":"突击",
            "fz_tuji_info":"摸牌阶段摸牌时，你可以少摸任意张牌，然后获得等量的角色的各一张手牌，然后视为你对这些角色使用一张【杀】。",
            "fz_chedian":"掣电",
            "fz_chedian_info":"①当你使用或打出【闪】或【闪电】或【杀】时，你可以进行判定。②当你的判定的判定牌生效后，若结果为：黑桃，你可对一名其他角色造成2点雷电伤害；梅花：你回复1点体力并可对一名其他其他角色造成1点雷电伤害。",
            "fz_shuangdao":"双刀",
            "fz_shuangdao_info":"锁定技，你使用【杀】次数上限+1。",
            "fz_jimou":"计谋",
            "fz_jimou_info":"出牌阶段开始时，你可以失去任意点体力并摸等量的牌，然后直到回合结束，你计算与其他角色的距离时-X，且你可以多使用X张【杀】（X为你失去的体力值）",
            "fz_chaofeng":"朝凤",
            "fz_chaofeng_info":"出牌阶段限两次，你可以横置至多三名角色，然后用一张手牌与这些角色同时拼点，然后依次结算拼点结果，若你赢，则视为你对该角色使用一张火杀。",
            "fz_test":"测试",
            "fz_test_info":"这是一个用来做测试的技能。",
            "fz_fuji":"伏骑",
            "fz_fuji_info":"锁定技，当你使用牌时，你令所有攻击范围内有你的其他角色不能使用或打出牌响应此牌。",
            "fz_jiaozi":"骄恣",
            "fz_jiaozi_info":"锁定技，若你的体力值大于对方，则当你造成或受到伤害时，此伤害+1，若你的体力值不大于对方，则当你造成伤害时，你回复一点体力。",
            "fz_zhiheng":"制衡",
            "fz_zhiheng_info":"出牌阶段一次，你可以弃置任意张牌，然后摸双倍量的牌。",
            "fz_choujue":"仇决",
            "fz_choujue_info":"锁定技。当你杀死其他角色后，你加1点体力上限并摸两张牌，然后本回合发动【却敌】的次数上限+1。",
            "fz_xuenu":"血怒",
            "fz_xuenu_info":"当你使用牌时，你可以令一名没有“血祭”标记的其他角色获得一枚“血祭”标记。你对拥有“血祭”标记的其他角色使用牌没有距离限制。拥有“血祭”的角色出牌阶段开始时失去1点体力，然后令你回复1点体力，若你没有受伤则改为摸一张牌。你的出牌阶段开始时，你可以依次对拥有“血祭”标记的所有其他角色造成一点伤害并回复一点体力，若你没有受伤则改为增加一点体力上限，然后移去其“血祭”标记。",
            "fz_xuenu_mark":"血祭",
            "fz_xuenu_mark_info":"",
            "fz_hunzi":"魂姿",
            "fz_hunzi_info":"觉醒技，准备阶段，若你的体力值为1，你加1点体力上限。",
            "fz_weizhen":"威震",
            "fz_weizhen_info":"觉醒技，当你使用一张装备牌后，你须加1点体力上限，回复1点体力，然后获得技能〖怒斩〗。",
            "fz_nuzhan":"怒斩",
            "fz_nuzhan_info":"当你使用【杀】指定目标后，你可以使此【杀】额外伤害加1。",
            "fz_xinfencheng":"焚城",
            "fz_xinfencheng_info":"出牌阶段限一次，你可以令所有其他角色各选择一项：弃置至少X张牌(X为该角色的上家以此法弃置牌的数量+1且至少为2)；或受到你对其造成的2点火焰伤害。",
            "fz_qiangxi":"强袭",
            "fz_qiangxi_info":"当你使用牌时，你可以对一名其他角色造成一点伤害。",
            "fz_shuangji":"双戟",
            "fz_shuangji_info":"出牌阶段限一次，若你的体力值上限大于2，你可以减2点体力上限，然后令一个装备区有牌的其他角色减2点体力上限。",
            "fz_yongsi":"庸肆",
            "fz_yongsi_info":"锁定技，摸牌阶段，你多摸X+Y张牌。弃牌阶段开始时，你弃置X张牌。（X为场上势力数，Y为你当前体力值）",
            "fz_qixi":"奇袭",
            "fz_qixi_info":"当你使用或打出牌时，或当其他角色使用一张【过河拆桥】或【顺手牵羊】时，或当你成为其他角色使用【杀】或普通锦囊牌的目标后，或受到伤害后，你可以弃置一名有牌的其他角色一张牌。",
            "fz_renfu":"认父",
            "fz_renfu_info":"出牌阶段限两次，你可以将一枚“义父”标记交给一名没有“义父”标记的其他角色。其摸牌阶段多摸一张牌，出牌阶段开始时你可以获得其一张牌。该角色回合结束后，其移去“父”标记，然后若其装备区域有牌，则你可以获得其中一张牌，若没有牌则你视为对其使用一张【杀】。",
            "fz_renfu_mark":"义父",
            "fz_renfu_mark_info":"",
            "fz_hanzhan":"酣战",
            "fz_hanzhan_info":"当你使用【杀】对一名其他角色造成X点伤害后，你可以摸X张牌，然后你可以额外使用X张【杀】。",
            "fz_hanzhan2":"fz_hanzhan2",
            "fz_hanzhan2_info":"",
            "fz_zhiheng2":"制衡",
            "fz_zhiheng2_info":"主公技，其他吴势力角色造成1点伤害后，其可以令你进行一次判定，若为红色，你回复1点体力，若为黑色，你获得判定牌。",
            "fz_hanyong":"悍勇",
            "fz_hanyong_info":"锁定技。当你杀死其他角色后，你加1点体力上限。",
            "fz_yuyong":"愈勇",
            "fz_yuyong_info":"当你使用决斗造成伤害后，你可以进行判定，若为方片，则你增加一点体力上限。",
            "fz_shensu":"神速",
            "fz_shensu_info":"当你的以下阶段开始时，你可以选择一名其他角色视为使用一张杀：判定阶段，摸牌阶段，出牌阶段，弃牌阶段。",
            "fz_lianpo":"连破",
            "fz_lianpo_info":"出牌阶段，当你杀死一名其他角色后，你可以多出一张杀。",
            "fz_lianpo2":"fz_lianpo2",
            "fz_lianpo2_info":"",
            "fz_zhiheng3":"制衡",
            "fz_zhiheng3_info":"出牌阶段限一次，你可以弃置任意张牌并摸等量的牌，若你在发动〖制衡〗时弃置了所有手牌，则你多摸一张牌，然后你可以选择一名其他角色对其造成X点伤害，X为你以此法多获得的牌数。",
            "fz_guding2":"fz_guding2",
            "fz_guding2_info":"",
        },
    },
    intro:"",
    author:"冷静的麦克茜coldmax",
    diskURL:"",
    forumURL:"",
    version:"1.0",
},files:{"character":["fz_huangzhong.jpg","fz_zhoutai.jpg","fz_dianwei.jpg","fz_zhangchunhua.jpg","fz_guanyu.jpg","fz_xiahouyuan.jpg","fz_shenganning.jpg","fz_wuyi.jpg","fz_madai.jpg","fz_gaoshun.jpg","fz_chendao.jpg","fz_zhangjiao.jpg","fz_huaxiong.jpg","fz_sunce.jpg","fz_zhangfei.jpg","fz_zhangxingcai.jpg","fz_jiaxu.jpg","fz_taishici.jpg","fz_zhaoyun.jpg","fz_lvbu.jpg","fz_tongyuan.jpg","fz_xusheng.jpg","fz_ganning.jpg","fz_pangtong.jpg","fz_wenyang.jpg","fz_machao.jpg","fz_caocao.jpg","fz_manchong.jpg","fz_huanggai.jpg","fz_wuqidashi.jpg","fz_zhangliao.jpg","fz_shixuekuangmo.jpg","fz_sunquan.jpg","fz_shenguojia.jpg","fz_zhugeke.jpg","fz_shenxunyu.jpg","fz_quyi.jpg"],"card":[],"skill":[]}}})